/**
 * 分销员管理模拟数据
 * 用于前端页面测试，后端接口开发完成后可移除
 */

// 模拟分销员树形数据
export const mockDistributorTree = [
  {
    distributor_id: 1,
    user_id: 101,
    nickname: "张三",
    avatar: "https://via.placeholder.com/60x60",
    distributor_code: "D001001",
    level: 1,
    depth: 0,
    phone: "13800138001",
    store_id: 1,
    store_name: "上海淮海路店",
    parent_id: null,
    parent_name: null,
    commission_balance: 1250.50,
    direct_sub_count: 3,
    total_sub_count: 8,
    status: 1,
    activated_at: "2024-01-15T10:30:00",
    children: [
      {
        distributor_id: 2,
        user_id: 102,
        nickname: "李四",
        avatar: "https://via.placeholder.com/60x60",
        distributor_code: "D001002",
        level: 2,
        depth: 1,
        phone: "13800138002",
        store_id: 1,
        store_name: "上海淮海路店",
        parent_id: 1,
        parent_name: "张三",
        commission_balance: 680.30,
        direct_sub_count: 2,
        total_sub_count: 3,
        status: 1,
        activated_at: "2024-01-20T14:30:00",
        children: [
          {
            distributor_id: 4,
            user_id: 104,
            nickname: "赵六",
            avatar: "https://via.placeholder.com/60x60",
            distributor_code: "D001004",
            level: 3,
            depth: 2,
            phone: "13800138004",
            store_id: 1,
            store_name: "上海淮海路店",
            parent_id: 2,
            parent_name: "李四",
            commission_balance: 120.80,
            direct_sub_count: 0,
            total_sub_count: 0,
            status: 1,
            activated_at: "2024-02-01T09:15:00",
            children: []
          },
          {
            distributor_id: 5,
            user_id: 105,
            nickname: "孙七",
            avatar: "https://via.placeholder.com/60x60",
            distributor_code: "D001005",
            level: 3,
            depth: 2,
            phone: "13800138005",
            store_id: 1,
            store_name: "上海淮海路店",
            parent_id: 2,
            parent_name: "李四",
            commission_balance: 95.20,
            direct_sub_count: 0,
            total_sub_count: 0,
            status: 0,
            activated_at: "2024-02-05T16:45:00",
            children: []
          }
        ]
      },
      {
        distributor_id: 3,
        user_id: 103,
        nickname: "王五",
        avatar: "https://via.placeholder.com/60x60",
        distributor_code: "D001003",
        level: 2,
        depth: 1,
        phone: "13800138003",
        store_id: 1,
        store_name: "上海淮海路店",
        parent_id: 1,
        parent_name: "张三",
        commission_balance: 420.75,
        direct_sub_count: 1,
        total_sub_count: 1,
        status: 1,
        activated_at: "2024-01-25T11:20:00",
        children: [
          {
            distributor_id: 6,
            user_id: 106,
            nickname: "周八",
            avatar: "https://via.placeholder.com/60x60",
            distributor_code: "D001006",
            level: 3,
            depth: 2,
            phone: "13800138006",
            store_id: 1,
            store_name: "上海淮海路店",
            parent_id: 3,
            parent_name: "王五",
            commission_balance: 88.60,
            direct_sub_count: 0,
            total_sub_count: 0,
            status: 1,
            activated_at: "2024-02-10T13:30:00",
            children: []
          }
        ]
      },
      {
        distributor_id: 7,
        user_id: 107,
        nickname: "吴九",
        avatar: "https://via.placeholder.com/60x60",
        distributor_code: "D001007",
        level: 2,
        depth: 1,
        phone: "13800138007",
        store_id: 1,
        store_name: "上海淮海路店",
        parent_id: 1,
        parent_name: "张三",
        commission_balance: 220.40,
        direct_sub_count: 0,
        total_sub_count: 0,
        status: 1,
        activated_at: "2024-02-15T08:45:00",
        children: []
      }
    ]
  },
  {
    distributor_id: 8,
    user_id: 108,
    nickname: "郑十",
    avatar: "https://via.placeholder.com/60x60",
    distributor_code: "D002001",
    level: 1,
    depth: 0,
    phone: "13800138008",
    store_id: 2,
    store_name: "北京朝阳店",
    parent_id: null,
    parent_name: null,
    commission_balance: 890.25,
    direct_sub_count: 1,
    total_sub_count: 1,
    status: 1,
    activated_at: "2024-01-10T15:20:00",
    children: [
      {
        distributor_id: 9,
        user_id: 109,
        nickname: "冯十一",
        avatar: "https://via.placeholder.com/60x60",
        distributor_code: "D002002",
        level: 2,
        depth: 1,
        phone: "13800138009",
        store_id: 2,
        store_name: "北京朝阳店",
        parent_id: 8,
        parent_name: "郑十",
        commission_balance: 340.80,
        direct_sub_count: 0,
        total_sub_count: 0,
        status: 1,
        activated_at: "2024-02-20T10:15:00",
        children: []
      }
    ]
  }
]

// 模拟统计数据
export const mockStatistics = {
  level1Count: 2,
  level2Count: 4,
  level3Count: 3,
  totalCommission: 4128.48,
  totalDistributors: 9,
  activeDistributors: 8,
  inactiveDistributors: 1
}

// 模拟分销员详情
export const mockDistributorDetail = {
  distributor_id: 1,
  user_id: 101,
  nickname: "张三",
  avatar: "https://via.placeholder.com/60x60",
  distributor_code: "D001001",
  level: 1,
  depth: 0,
  phone: "13800138001",
  store_id: 1,
  store_name: "上海淮海路店",
  parent_id: null,
  parent_name: null,
  commission_balance: 1250.50,
  direct_sub_count: 3,
  total_sub_count: 8,
  status: 1,
  activated_at: "2024-01-15T10:30:00"
}

// 模拟佣金明细
export const mockCommissionDetail = {
  commission_summary: {
    total_commission: 2580.75,
    withdrawn_commission: 1330.25,
    pending_commission: 1250.50
  },
  commission_records: [
    {
      id: 1001,
      customer_name: "客户A",
      order_amount: 1000.00,
      commission_amount: 100.00,
      commission_rate: 0.10,
      withdrawal_status: 0,
      created_at: "2024-12-10T14:30:00"
    },
    {
      id: 1002,
      customer_name: "客户B",
      order_amount: 800.00,
      commission_amount: 80.00,
      commission_rate: 0.10,
      withdrawal_status: 0,
      created_at: "2024-12-08T10:15:00"
    },
    {
      id: 1003,
      customer_name: "客户C",
      order_amount: 1200.00,
      commission_amount: 120.00,
      commission_rate: 0.10,
      withdrawal_status: 1,
      created_at: "2024-12-05T16:45:00"
    },
    {
      id: 1004,
      customer_name: "客户D",
      order_amount: 600.00,
      commission_amount: 60.00,
      commission_rate: 0.10,
      withdrawal_status: 0,
      created_at: "2024-12-03T09:20:00"
    },
    {
      id: 1005,
      customer_name: "客户E",
      order_amount: 1500.00,
      commission_amount: 150.00,
      commission_rate: 0.10,
      withdrawal_status: 1,
      created_at: "2024-12-01T13:10:00"
    }
  ]
}

// 模拟API响应格式的包装函数
export const wrapMockResponse = (data) => {
  return Promise.resolve({
    code: 200,
    message: "操作成功",
    data: data
  })
}

// 模拟延迟
export const delay = (ms = 300) => {
  return new Promise(resolve => setTimeout(resolve, ms))
} 